<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		
	</head>
	<body>
		<script type="text/javascript">
			window.onload = function() {
				var cars = ['奔驰', '宝马', '奥迪'];
				var ul = document.createElement('ul');
				for (var i = 0; i < cars.length; i++) {
					var li = document.createElement('li');
					var textNode = document.createTextNode(cars[i]);
					li.appendChild(textNode);
					
					li.onmouseover = function() {
						// <li style='backgrount-color:red'></li>
						// this就代表当前这个li
						this.style.backgroundColor = 'gray';
					}
					li.onmouseout = function() {
						// <li style='backgrount-color:red'></li>
						// this就代表当前这个li
						this.style.backgroundColor = '';
					}
					ul.appendChild(li);
				}
				
				document.body.appendChild(ul);
			}
		</script>
	</body>
</html>
